#pragma once
#include "spdlog/sinks/stdout_color_sinks.h"
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/spdlog.h>

void init_logger(const std::string &path)
{
    auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
    console_sink->set_level(spdlog::level::trace);
    console_sink->set_pattern("[%H:%M:%S.%e][%^%l%$] %v");

    auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(path, true);
    file_sink->set_level(spdlog::level::warn);
    file_sink->set_pattern("[%Y-%m-%d %H:%M:%S.%e][%n]%v");
    std::vector<spdlog::sink_ptr> sinks{console_sink, file_sink};
    auto logger = std::make_shared<spdlog::logger>("combine_logger", sinks.begin(), sinks.end());

    spdlog::set_default_logger(logger);
}

void QuitLogget()
{
    spdlog::drop_all();
}
